#include <InvadersApp.h>

InvadersApp::InvadersApp()
{
  _introState = NULL;
  _extrasState = NULL;
  _playState = NULL;
  _pauseState = NULL;
  _endGameState = NULL;
  _root = NULL;
}

InvadersApp::~InvadersApp()
{
  if (_gameManager) delete _gameManager;
  if (_endGameState) delete _endGameState;
  if (_pauseState) delete _pauseState;
  if (_playState) delete _playState;
  if (_extrasState) delete _extrasState;
  if (_introState) delete _introState;
  if (_root) _root->shutdown();
}

int InvadersApp::start()
{
  _root = new Ogre::Root();
  _introState = new IntroState();
  _extrasState = new ExtrasState();
  _playState = new PlayState();
  _pauseState = new PauseState();
  _endGameState = new EndGameState();
  _gameManager = new GameManager();

  _gameManager->start(_introState);

  return 0;
}

// main

int main(int argc, char* argv[])
{
  InvadersApp().start();
  return 0;
}
